<!--
/**
 * comments partial view.
 *
 * @package    FinalsClub
 * @subpackage comments
 * @author     Colin Hom
 */
 
 *This component is for use only in the context of comments on a single material*
 -->

<h3 class="responses"><?= $comment_pager->getNbResults() ?> Responses<a href="#reply_box" id="comment-reply">Reply &raquo;</a></h3>
<ul class="comment-list">

<?php
use_helper('Form');
if($comment_pager->getNbResults() == 0){
	echo "<h3 align = 'center' >Be the first to leave a comment!</h3>";}
else{
	foreach($comment_pager->getResults() as $key => $comment){
	 		/* If a list of comments on different materials is needed */
	 ?>
	
		<li>
			<div class="meta">
				<p><?= $comment->getUserRelatedByUserId()->getHlFullName() ?> on <?= $comment->getCreatedAt() ?></p>
				<p class="stars three">3 stars</p>
			</div>
			<p><?= $comment->getContent() ?></p>
		</li>
<?php } //end foreach 
}	//end else
	?>

</ul>
<?= form_tag('comments/create', array('class' => 'leave-reply', 'id' => 'commentForm')) ?>
	<fieldset>
		<div class="left-border">
			<label>Leave a Reply</label>
			<a name="reply_box"></a>
			<?= $comment_form['content']->render() ?>
			<?= $comment_form->renderHiddenFields() ?>
		</div>
	</fieldset>
	<fieldset class = 'controls'>
		<input type="submit" value="Leave a Reply" />	
	</fieldset>
</form>
